/**
 * This class was created by Nick Popescu to be used in Space Trader
 */
import java.io.Serializable;

/**
 * This is class is used to generate the NPCs and the Player for the game. It
 * contains the base variables that would be applicable to the characters.
 * 
 * @author Nick Popescu
 * @version 1.0
 * 
 */

public class Character implements Serializable /* implements Model */{

    /**
     * This string represents the name of the character
     */
    private String name;

    /**
     * This represent whether or not the character is alive
     */
    private final boolean alive;

    /**
     * This represents the player's ship
     */
    private Ship ship;

    /**
     * This array represents the name of the skill points the character has
     */
    private final String[] skillNames = new String[] { "Pilot", "Fighter",
	    "Trader", "Engineer" };

    /**
     * This array represents the distribution of points the player has across
     * the categories
     */
    private int[] skillDistrib = new int[] { 0, 0, 0, 0 };

    /**
     * Creates a new instance of character using the name and skill point
     * distribution array passed in as parameters
     * 
     * @param name
     *            The name of the character
     * @param skillDistrib
     *            An integer array that holds the distribution of 16 skill
     *            points
     */

    public Character(String name, int[] skillDistrib) {
	this.name = name;
	this.alive = true;
	this.skillDistrib = skillDistrib.clone();
    }
    
    /**
     * Creates a new player wih no name or skill points yet
     */
    public Character(){
	this.alive = true;
    }

    /**
     * @return True if the character is still alive, false otherwise
     */
    public boolean isAlive() {
	return alive;
    }

    /**
     * Sets the characters name with the name passed in as a parameter
     * 
     * @param name
     *            The name of the character
     */
    public void setName(String name) {
	this.name = name;
    }

    /**
     * Sets the skill distribution array with the array passed in as a parameter
     * 
     * @param skillDistrib
     *            An array with the character's skill distribution points
     */
    public void setSkillArray(int[] skillDistrib) {
	this.skillDistrib = skillDistrib.clone();
    }

    /**
     * @return The characer's name
     */
    public String getName() {
	return name;
    }

    /**
     * @return The skill distribution array of the character
     */
    public int[] getSkillArray() {
	return skillDistrib;
    }

    /**
     * @return The array containing the names of the four different skills a
     *         character can have ("Pilot," "Fighter," "Trader," and
     *         "Engineer.")
     */
    public String[] getSkillNames() {
	return skillNames;
    }

    /**
     * Sets the character's ship to be the ship passed in as a parameter
     * 
     * @param ship
     *            The ship that the player will use
     */
    public void setShip(Ship ship) {
	this.ship = ship;
    }

    /**
     * @return The player's ship
     */
    public Ship getShip() {
	return ship;
    }

    /**
     * This method returns a string representing the class Character
     * 
     * @return a String representing the charachter class
     */
    public String toString() {
	return this.name;
    }

}
